{include file="public/nheader" /}
<style>
    .laytable-cell-checkbox .layui-disabled.layui-form-checked i {
        background: #fff !important;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="isshow" lay-verify="">
                                <option value="">状态</option>
                                <option value="1" {if !empty(input('get.isshow')) &&
                                    input('get.isshow')==1}selected{/if}>显示</option>
                                <option value="2" {if !empty(input('get.isshow')) &&
                                    input('get.isshow')==2}selected{/if}>隐藏</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="cate">
                                <option value="">请选择主分类</option>
                                {foreach $cate as $v}
                                <option value="{$v.id}" {if !empty(input('get.cate')) &&
                                    input('get.cate')==$v.id}selected{/if}>{$v.name}{if $v.isshow == 2}(已隐藏){/if}
                                </option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <!-- // 默认搜索 -->
                        <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>搜索</button>
                        <!-- // 删除所有 -->
                        <button class="layui-btn icon-btn layui-btn-danger" lay-batch="lay-tableList"
                            data-url="/agent/subcate_exc">批量导入
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    {{#  if(d.daoru ==1){ }}
    <a style="color:red">已导入</a>
    <div class="layui-divider layui-divider-vertical"></div>
    {{# }if(d.daoru ==2) { }}
    <a class="layui-table-text" style="color:blue"  data-url="/agent/subcate_exc?id={{d.id}}" lay-event="del">导入</a>
    {{#  } }}
</script>
<script type="text/html" id="checkbd">
    <input type="checkbox"  {{d.daoru == 1?'disabled':'name="layTableCheckbox"'}} title="" lay-skin="primary" data-id = "{{ d.id }}">
</script>
{include file="public/nfooter"}

<script>
    layui.use(['table'], function () {
        var table = layui.table;

        //     /*
        //      * 初始化表格
        //     */
        var isTable = table.render({
            elem: "#lay-tableList"
            , url: "{:url()}"
            , page: true
            , size: 'lg'
            , even: true
            , cols: [[
                {
                    templet: "#checkbd",
                    title: "<input type='checkbox' name='layTableCheckbox' title='' lay-skin='primary' lay-filter='layTableAllChoose'> ",
                    width: 48
                },
                // { type: 'checkbox', width: 60 },
                { field: 'id', align: 'center', sort: true, width: 80, title: 'ID' },
                { field: 'name', align: 'center', width: 120, title: '分类名称' },
                {
                    field: 'images', align: 'center', width: 200, templet: function (d) {
                        return d.images ? '<div><img style="width:50px" src="' + d.images + '"lay-image-click=""></div>' : '<div></div>';
                    }, title: '图标'
                },
                { field: 'cate_name', width: 150, align: 'center', title: '主分类' },
                { field: 'sort', align: 'center', width: 100, title: '排序' },
                { field: 'created', width: 200, align: 'center', title: '添加时间' },
                { align: 'center', toolbar: '#tableBar', width: 250, title: '操作' },
            ]]
        })
    })
</script>
</body>